package com.hydra.auth.repository;

import com.hydra.auth.entity.DictData;
import com.hydra.auth.entity.DictType;
import com.hydra.auth.entity.SysOperateLog;
import com.hydra.auth.mapper.DictTypeMapper;
import com.hydra.auth.mapper.SysOperateLogMapper;
import com.hydra.base.entity.CodeEntity;
import com.hydra.base.operate.log.annotation.OperateLogInject;
import com.hydra.base.operate.log.entity.BaseOperateLogEntity;
import com.hydra.base.services.BaseService;
import org.springframework.stereotype.Repository;

import javax.annotation.Resource;

@Repository
public class DictTypeService extends BaseService<DictType, DictTypeMapper> {

    @Resource
    private SysOperateLogMapper sysOperateLogMapper;

    /**切面进行操作日志记录*/
    @Override
    @OperateLogInject(cate = "SYS_DICT_TYPE")
    public void handleOperateLog(DictType data, DictType history) {
        super.handleOperateLog(data, history);
    }

    /**保存操作日志*/
    @Override
    public void saveOperateLog(BaseOperateLogEntity operateLogInfo, DictType updateData, DictType historyData) {
        SysOperateLog log = operateLogInfo.copy(SysOperateLog.class);
        sysOperateLogMapper.insert(log);
    }

}
